package io;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("video.mp4");
        FileOutputStream fos = new FileOutputStream("copy.mp4");
        long start = System.currentTimeMillis();
        int len;
        while ((len = fis.read()) != -1) {
            fos.write(len);
        }
        fos.close();
        fis.close();
        long end = System.currentTimeMillis();
        System.out.println("拷贝完成,总耗时:" + (end - start) + "毫秒");
        /*        FileInputStream fis = new FileInputStream("video.mp4");
        FileOutputStream fos = new FileOutputStream("copy.mp4");
        long start = System.currentTimeMillis();
        int len;
        while ((len = fis.read()) != -1) {
            fos.write(len);
        }
        fos.close();
        fis.close();
        long end = System.currentTimeMillis();
        System.out.println("耗时:" + (end - start));*/
    }
}
